<template id="tmp-item-class-select">
    <span>
         <el-cascader
             placeholder="请选择类型"
             :options="itemClass"
             v-model="value"
             :clearable="clearable"
             @change="change"
             :props="{ expandTrigger: 'hover' }"></el-cascader>
    </span>
</template>
<script>
    Vue.component("component-item-class-select", {
        template:"#tmp-item-class-select",
        props:["value","clearable"],
        data() {
            return {
                itemClass:itemClass,
            };
        },
        mounted() {
            if (!this.clearable){
                this.itemClass.forEach(item=>{
                    if(item.children[0].label==='全部'){
                        item.children.splice(0,1);
                    }
                })
            }
        },
        watch:{
        },
        methods:{
            change(val){
                // this.$emit("update:value",val);   //:c.sync
                this.$emit("input",val);        //v-model,必须是value
            }
        },
    });
</script>

